{% extends '/pg/index_pg.html' %}
{% block operation %}
<script type="text/javascript">
    $(document).ready(function () {

        $('#tableContainer').jtable({
            title: 'Tabella Imballaggi',
            messages: window.italianMessages,
            defaultDateFormat:"dd-mm-yy",
            paging: true,
            pageSize: 20,
            sorting: true,
            defaultSorting: 'denominazione ASC',

            actions: {
                listAction: '/pg/as_AliquotaIva/List',
                createAction: '/pg/as_AliquotaIva/Create',
                updateAction: '/pg/as_AliquotaIva/Update',
                deleteAction: '/pg/as_AliquotaIva/Delete'
            },
            fields: {
                id: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false
                },

                denominazione: {
                    title: 'Denominazione',
                    width: '8%',
                    inputClass: 'validate[required,scroll=false,maxSize[99]]'
                },
                denominazione_breve: {
                    title: 'Den. Breve',
                    width: '8%',
                    inputClass: 'validate[required,scroll=false,maxSize[9]]'
                },
                percentuale: {
                    title: 'Percentuale',
                    width: '4%',
                    inputClass: 'validate[required,scroll=false,custom[integer]]' ,
                    display: function (data) {
                            //return data.record.percentuale.slice(0,-5);
                            return parseFloat(data.record.percentuale).toFixed(0);
                    }

                },
                percentuale_detrazione: {
                    title: 'Detrazione',
                    width: '8%',
                    inputClass: 'validate[scroll=false,custom[integer]]',
                    display: function (data) {
                        //return data.record.percentuale.slice(0,-5);
                        return parseFloat(data.record.percentuale_detrazione).toFixed(0);
                    }
                },
                descrizione_detrazione: {
                    title: 'Detrazione descrizione',
                    width: '15%',
                },
                id_tipo: {
                    title: 'Tipo Aliquota Iva',
                    width: '13%',
                    options: '/pg/as_AliquotaIva/GetTipoAliquotaIva',
                },

            },
            //Initialize validation logic when a form is created
            formCreated: function (event, data) {
                data.form.validationEngine();
            },
            //Validate form when it is being submitted
            formSubmitting: function (event, data) {
                return data.form.validationEngine('validate');
            },
            //Dispose validation logic when form is closed
            formClosed: function (event, data) {
                data.form.validationEngine('hide');
                data.form.validationEngine('detach');
            }
        });

        $('#tableContainer').jtable('load');

});
</script>
<div id="box">
    <h2><a href="/pg/parametri">PARAMETRI:</a> > <a href="/pg/as_AliquotaIva/show"><i>Anagrafica Aliquote iva</i></a></h2>
    <a id="iconaricerca" title="Icona che apre la sezione di ricerca" href="#"><img  src="/tpl/img/icona-lente48.png" /></a>

{% include "pg/filterkey/fk_aliquotaiva.html" with context %}

<div id="tableContainer"></div>
        </div>

{%endblock%}
